#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H

#include <QtGui/QDialog>
#include <QNetworkAccessManager>

class ConfigHelper;
class QTreeWidget;
class QTimer;
class QNetworkReply;

namespace Ui {
    class ConfigDialog;
}

class ConfigDialog : public QDialog {
    Q_OBJECT
public:
    ConfigDialog(QWidget *parent = 0);
    ~ConfigDialog();

    bool eventFilter(QObject *obj, QEvent *ev);
    void showCompletion(QStringList search);

protected:
    void changeEvent(QEvent *e);

private slots:
    void proxyChange(QString proxy);
    void proxyPortChange(QString proxy);
    void proxyEnable(int stat);
    void saveAndExit();
    void exit();
    void moveUp();
    void moveDown();
    void deleteItem();
    void addItem();

    void doneCompletion();
    void autoSuggest();
    void handleNetworkData(QNetworkReply *networkReply);
private:
    Ui::ConfigDialog *m_ui;

    ConfigHelper *confHelper_;

    QTreeWidget *popup;
    QTimer *timer;
    QNetworkAccessManager networkManager;
};

#endif // CONFIGDIALOG_H
